package com.irssproject.app.web.action.lectorRSS;

import java.util.Map;
import java.util.logging.Logger;

import org.apache.struts2.interceptor.SessionAware;

import com.irssproject.app.service.lectorRSS.iface.SubscripcioService;
import com.irssproject.app.utils.Constants;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;


public class LectorRSSAction extends ActionSupport implements SessionAware {

	private static final long serialVersionUID = -1907995298880332913L;

	Logger logger = Logger.getLogger(LectorRSSAction.class.getName());

	private String etiqueta;
	private String fraseLectura;

	SubscripcioService subscripcioService;
	
	public LectorRSSAction(SubscripcioService subscripcioService)
	{
		this.subscripcioService = subscripcioService;
	}
	
	private Map<String,Object> session;	

	public void setSession(Map<String, Object> arg0) {
		session = arg0;
	}
	
	public Map<String,Object> getSession(){
		return session;
	}
	


	public String mostrarLectorPrincipal(){

		try
		{
			session = ActionContext.getContext().getSession();
			if (session.containsKey(Constants.SESSIO_USUARI_AUTENTICAT))
			{
				logger.info("Mostrant la pagina principal");
				session.put(Constants.LECTURA_ANTERIOR, null);
				session.put(Constants.COMPTADOR_TEMPS, null);
			}
		}
		catch (Exception e) 
		{
			e.printStackTrace();
		}

		return SUCCESS;
	}
	


}
